/**
 * 
 */
package com.alstudio.ui.module.setting;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import com.alstudio.app.ALLocalEnv;
import com.alstudio.module.xmpp.distributor.versioncheck.VersionManager;
import com.alstudio.ui.base.TitleBarActivity;
import com.alstudio.ui.module.userguide.UserGuideActivity;
import com.loovee.imaohu.R;

/**
 * 关于界面，继承与TitleBar界面。缺省title栏上 只有一个返回按钮。
 * 
 * @author Alonso Lee
 * 
 */
public class AboutActivity extends TitleBarActivity {
	// 调试TAG
	private final String TAG = "AboutActivity";

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		// 初始化UI
		setupView(this, TAG);
	}

	@Override
	protected void onStart() {
		// TODO Auto-generated method stub
		super.onStart();
	}

	@Override
	protected void onStop() {
		// TODO Auto-generated method stub
		super.onStop();
	}

	@Override
	protected void setupView(Context context, String name) {
		// TODO Auto-generated method stub
		super.setupView(context, name);
		// 设定本界面layout
		setTitleBarContentView(R.layout.about_layout);
		// 设定状态栏中间文字区域内容
		setCenterTextViewMessage(getString(R.string.TxtAboutTitle));
		setViewOnclickListener(R.id.check_update_item, this);
		setViewOnclickListener(R.id.about_item, this);
		
//		// 设定左边按钮背景图片
//		setLeftButtonBackground(R.drawable.title_bar_back_button_selector);
//		// 隐藏右边按钮
//		hideRightButton(true);
	}


	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		super.onClick(v);
		switch(v.getId()){
		case R.id.check_update_item:
			VersionManager.getInstance().checkNewVersion(ALLocalEnv.getLocalEnv().getVersionConfig().getAppVersion(), "Android", ALLocalEnv.getLocalEnv().getVersionConfig().disp1, ALLocalEnv.getLocalEnv().getVersionConfig().port);
			showLoadingProgress();
			break;
		case R.id.about_item:
			Intent i = new Intent(this, UserGuideActivity.class);
			startActivity(i);
			break;
		}
	}

	/* (non-Javadoc)
	 * @see com.alstudio.ui.base.BaseActivity#initData()
	 */
	@Override
	protected void initData() {
		// TODO Auto-generated method stub
		
	}

}
